<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"
    default-autowire="byName"
    default-lazy-init="true">
    <!-- 启用注解的事物支持 -->
    <tx:annotation-driven transaction-manager="transactionManager" 
    	proxy-target-class="true" />
    <!-- 声明一个Hibernate 3 的事物管理器供代理类自动管理事务用 -->
    <bean id="transactionManager"
        class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory">
            <ref local="sessionFactory" />
        </property>
    </bean>

    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="configLocation" value="classpath:hibernate.cfg.xml" />
    </bean>

    <bean id="bookDao" class="net.zhoulang.dao.BookDao">
        <property name="sessionFactory">
            <ref bean="sessionFactory" />
        </property>
    </bean>

    <bean id="bookService" class="net.zhoulang.service.BookService">
        <property name="book">
            <ref bean="bookDao" />
        </property>
    </bean>

    <bean id="bookAction" class="net.zhoulang.action.BookAction">
        <property name="bookService">
            <ref bean="bookService" />
        </property>
    </bean>
</beans>